Skip to content

add translation and lowering of OperatorOp#2969

Merged
albi3ro merged 22 commits into
mainfrom
handle-operator2
Jun 30, 2026
Merged

add translation and lowering of OperatorOp#2969
albi3ro merged 22 commits into
mainfrom
handle-operator2

Conversation

@albi3ro

@albi3ro albi3ro commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Context:

Now that Operator2 has been added to Pennylane and can be captured into plxpr, it's time to lower it to MLIR.

Description of the Change:

Benefits:

Possible Drawbacks:

Had to switch op_name from being a StrProp to being a StrAttr. Seems to work now.

Related GitHub Issues:

[sc-121978] [sc-121484]

@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.98%. Comparing base (a97d03a) to head (d586798).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2969   +/-   ##
=======================================
  Coverage   96.97%   96.98%           
=======================================
  Files         166      166           
  Lines       19209    19243   +34     
  Branches     1788     1791    +3     
=======================================
+ Hits        18628    18662   +34     
  Misses        429      429           
  Partials      152      152           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread mlir/lib/Quantum/IR/QuantumOps.cpp
@albi3ro albi3ro requested review from kipawaa and mudit2812 June 25, 2026 18:32

@kipawaa kipawaa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks @albi3ro !

Comment thread frontend/test/lit/test_operator.py Outdated
Comment thread frontend/test/pytest/test_operator.py
Co-authored-by: River McCubbin <river.mccubbin@xanadu.ai>

@mudit2812 mudit2812 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great Christina, just one blocking comment regarding how we're lowering scalar parameters of qref.operator

Comment thread doc/requirements.txt
Comment thread .dep-versions
Comment thread mlir/include/Quantum/IR/QuantumOps.td
Comment thread mlir/lib/Quantum/IR/QuantumOps.cpp
Comment thread frontend/catalyst/from_plxpr/from_plxpr.py Outdated
Comment thread frontend/catalyst/from_plxpr/qfunc_interpreter.py
Comment thread frontend/test/lit/test_operator.py
Comment thread frontend/catalyst/from_plxpr/qref_jax_primitives.py Outdated
Comment thread frontend/catalyst/from_plxpr/qref_jax_primitives.py Outdated
Comment thread frontend/catalyst/from_plxpr/qref_jax_primitives.py Outdated
Comment thread frontend/test/lit/test_operator.py
@dime10

dime10 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

I'd like to have a look over the changes before merging :) Is it correct that this is only part of the op that is supported? @albi3ro your goal is to a support in stages across multiple prs?

@albi3ro

albi3ro commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

I'd like to have a look over the changes before merging :) Is it correct that this is only part of the op that is supported? @albi3ro your goal is to a support in stages across multiple prs?

So #2979 adds specialized lowerings for things that fit CustomOp and all the other specialized ops. In PennyLaneAI/pennylane#9729 and PennyLaneAI/pennylane#9730 Mudit is adding specialized capturing for adjoint and controlled. Following those PR's, we will be able to add lowerings for adjoint and ctrl. Then we will have a follow up for things with python-only data.

@dime10 dime10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 🎉

Comment thread doc/releases/changelog-dev.md
Comment thread frontend/catalyst/from_plxpr/from_plxpr.py Outdated
Comment thread frontend/catalyst/from_plxpr/qref_jax_primitives.py
Comment thread frontend/catalyst/from_plxpr/qref_jax_primitives.py
Comment thread frontend/catalyst/from_plxpr/qref_jax_primitives.py
@albi3ro albi3ro merged commit eba1d8c into main Jun 30, 2026
39 checks passed
@albi3ro albi3ro deleted the handle-operator2 branch June 30, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants